package com.wing.financeSet.model.entity;

import java.io.Serializable;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.enums.IEnum;
import com.wing.mybatis.common.BaseEntity;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;

/**
 * 科目设置
 *
 * @author
 */
@Data
@NoArgsConstructor
@Accessors(chain = true)
@TableName("fin_subject_set")
public class SubjectSet extends BaseEntity<SubjectSet> implements Serializable {

    private static final long serialVersionUID = 1L;

    public enum BalanceDirection implements IEnum<Integer> {
        /**
         * 资产
         */
        borrow(0,"借"),
        /**
         * 负债
         */
        loan(1,"贷");

        private int code;
        private String desc;

        BalanceDirection(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }
    /**
     * 余额方向
     */
    private BalanceDirection balanceDirection;

    /**
     * 科目类型描述
     */
    @TableField(exist = false)
    private String balanceDirectionDesc;

    public String getBalanceDirectionDesc() {
        return balanceDirection == null ? null : balanceDirection.getDesc();
    }

    public enum SubjectType implements IEnum<Integer> {

        /**
        * 资产
        */
        property(0,"资产"),
        /**
        * 负债
        */
        liabilities(1,"负债"),
        /**
        * 权益
        */
        rights(2,"权益"),
        /**
        * 成本
        */
        cost(3,"成本"),
        /**
        * 损失
        */
        loss(4,"损失");

        private int code;
        private String desc;

        SubjectType(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum Currency implements IEnum<Integer> {

        /**
        * 人民币
        */
        rmb(0,"人民币"),
        /**
        * 美元
        */
        usd(1,"美元"),
        /**
        * 日元
        */
        jpy(2,"日元"),
        /**
        * 韩元
        */
        krw(3,"韩元"),
        /**
        * 其他
        */
        other(4,"其他");

        private int code;
        private String desc;

        Currency(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum SubsidiaryAccount implements IEnum<Integer> {

        /**
        * 部门核算
        */
        department(0,"部门核算"),
        /**
        * 项目核算
        */
        project(1,"项目核算"),
        /**
        * 个人往来
        */
        person(2,"个人往来"),
        /**
        * 客户往来
        */
        customer(3,"客户往来"),
        /**
        * 供应商往来
        */
        supplier(4,"供应商往来");

        private int code;
        private String desc;

        SubsidiaryAccount(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    public enum LedgerFormat implements IEnum<Integer> {

        /**
        * 金额式
        */
        amount(0,"金额式"),
        /**
        * 数量金额式
        */
        quantityAmount(1,"数量金额式"),
        /**
        * 外币金额式
        */
        foreignCurrency(2,"外币金额式"),
        /**
        * 外币数量式
        */
        currencyQuantity(3,"外币数量式");

        private int code;
        private String desc;

        LedgerFormat(int code,String desc){
            this.code=code;
            this.desc=desc;
        }

        @Override
        public Integer getValue(){
            return this.code;
        }

        public String getDesc(){
            return this.desc;
        }
    }

    /**
     * 创建者
     */
    private Long creator;

    /**
     * 修改者
     */
    private Long modifier;

    /**
     * 创建人
     */
    private String creatorName;

    /**
     * 修改人
     */
    private String modifierName;

    /**
     * 科目分类id
     */
    private Long subjectCategoryId;

    /**
     * 科目类型
     */
    private SubjectType subjectType;

    /**
    * 科目类型描述
    */
    @TableField(exist = false)
    private String subjectTypeDesc;

    public String getSubjectTypeDesc() {
        return subjectType == null ? null : subjectType.getDesc();
    }

    /**
     * 名称
     */
    private String name;

    /**
     * 助记码
     */
    private String mnemonicCode;



    /**
     * 币种
     */
    private Currency currency;

    /**
    * 币种描述
    */
    @TableField(exist = false)
    private String currencyDesc;

    public String getCurrencyDesc() {
        return currency == null ? null : currency.getDesc();
    }

    /**
     * 默认单位
     */
    private String unitName;

    /**
     * 辅助账类型
     */
    private SubsidiaryAccount subsidiaryAccount;

    /**
    * 辅助账类型描述
    */
    @TableField(exist = false)
    private String subsidiaryAccountDesc;

    public String getSubsidiaryAccountDesc() {
        return subsidiaryAccount == null ? null : subsidiaryAccount.getDesc();
    }

    /**
     * 账页格式
     */
    private LedgerFormat ledgerFormat;

    /**
    * 账页格式描述
    */
    @TableField(exist = false)
    private String ledgerFormatDesc;

    public String getLedgerFormatDesc() {
        return ledgerFormat == null ? null : ledgerFormat.getDesc();
    }

    /**
     * 父ID
     */
    private Long parentId;

    /**
     * 排序
     */
    private Integer sortNumber;

    /**
     * 是否有子节点，0：无子节点，1：有子节点
     */
    private Boolean hasChild;

    /**
     * 是否子节点有启用，0：无，1；有
     */
    private Boolean hasEnableChild;

    /**
     * 是否终极分类
     */
    private Boolean isFinal;
    private Boolean isDeleted;
    private String remark;
    @TableField(exist = false)
    private String subjectCategoryName;
}
